package effect.character.area;

import character.MyCharacter;
import modifier.character.CharacterModifier;
import effect.AreaEffect;
import game.CombatController;
import java.util.ArrayList;
import java.util.List;

public class AreaCharacterEffect extends AreaEffect {
    protected List<CharacterModifier> characterModifiers = new ArrayList<CharacterModifier>();

    @Deprecated
    protected AreaCharacterEffect() {}

    public AreaCharacterEffect(MyCharacter owner) {
        super(owner);
    }
    
    public void applyEffect(MyCharacter character) {
        switch(effectType) {
            case DAMAGE:
                System.out.println(effectName+" hits "+character+" for "+baseEffectAmount+" points of damage.");
                CombatController.dealDamage(owner, character, Math.round(baseEffectAmount));
                break;
            case HEALING:
                if(character.getPlayer().equals(owner.getPlayer())) {
                    System.out.println(effectName+" restores "+baseEffectAmount+" hit points to "+character+".");
                    CombatController.heal(owner, character, Math.round(baseEffectAmount));
                }
                break;
            case STATUS:
                character.addCharacterModifiers(characterModifiers);
                break;
        }
    }
    
    public void addCharacterModifier(CharacterModifier characterModifier) {
	characterModifiers.add(characterModifier);
    }
}
